﻿using Manager;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Text;
using System.Threading.Tasks;

namespace RemotingClient
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //确立通道传送方式
            ChannelServices.RegisterChannel(new TcpClientChannel(), false);
            //使用Activator.GetObject（）或者Activator.CreateInstance（）方法建立透明代理，控制远程对象
            PersonManager personManager = (PersonManager)Activator.GetObject(typeof(PersonManager), "tcp://localhost:8089/PersonTcp");
            //获取远程数据
            List<Person> personList = personManager.GetList();
            Console.Write(personList.Count);
            Console.ReadKey();
        }
    }
    
}
